package LeetCode.month01.day20;

public class No1343 {
    public int numOfSubarrays(int[] arr, int k, int threshold) {
        int count = 0;
        int sum = 0;
        int len = arr.length;
        for (int i = 0; i < k; i++) {
            sum+=arr[i];
        }
        if(sum/k>=threshold) count++;
        for (int i = k; i < len; i++) {
            sum=sum+arr[i]-arr[i-k];
            if(sum/k>=threshold) count++;
        }
        return count;
    }
}
